<%@ page language="java"  pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta name="format-detection" content="telephone=no" />
    <title>约来约美 </title>
    
    <link rel="stylesheet" href='<s:url value="/style/hhframe-1.0.0.css" />' />
    <link rel="stylesheet" href="<s:url value="/style/order.css" />" />
    <script src="<s:url value="/script/jquery-1.11.1.min.js" />"></script>
    <script src="<s:url value="/script/jquery.iscroll.5.js" />"></script>
    <script src="<s:url value="/script/hhframe-1.0.0.js" />"></script>
    <script src="<s:url value="/script/order.js" />"></script>
</head>
<body>
  
  <div class="framepage order confirm">
    
    <!-- header -->
    <div class="header">
      <a href="javascript:history.back();" class="pos-l icon hd-return">返回</a>
      <h1 class="hd-title">微信支付</h1>
    </div>
    
    <!-- content -->
    <div class="wrapper">
    <div class="content">
      
      <div class="intro">
         <h3>基本信息</h3>
        <p>商铺名称：${order.store_name}</p>
        <p>服务名称：${order.item_name}</p>
        <p>预约技师：${order.beautician_name}</p>
        <p>预约时间：<span class="time">${order.start_hour}</span></p>
        <p class="price">价格：￥${order.price}</p>
      </div>
            
      <a href="#"  id="wxpay" class="btn sub">确认付款</a>
    
    </div>
    </div>
    
  </div>
  <script type="text/javascript">
  function onBridgeReady(){
		 WeixinJSBridge.call('hideOptionMenu');
		}

		if (typeof WeixinJSBridge == "undefined"){
		    if( document.addEventListener ){
		        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		    }else if (document.attachEvent){
		        document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
		        document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		    }
		}else{
		    onBridgeReady();
		}
	var  obj =${alert};
	//alert(obj)
	$("#wxpay").one("click",function(){ 
	WeixinJSBridge.invoke('getBrandWCPayRequest',{
            "appId" : obj.appId,    //公众号名称，由商户传入
            "timeStamp":obj.timeStamp,//时间戳，自 1970 年以来的秒数
            "nonceStr" : obj.nonceStr, //随机串
            "package" : obj.packageValue,
            "signType" : obj.signType,          //微信签名方式:
            "paySign" : obj.paySign    //微信签名
            },function(res){                
            if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                //alert("充值成功感谢支持！");
                // window.location.reload()
                window.location.href="../centent!pay.do?falg=1&id=${order.order_id}";
            }else{
                window.location.href="../centent!pay.do?falg=2&id=${order.order_id}";
          		//window.location.href="http://183.33.212.175:8016/wxweb/config/oauth!execute.action";
            }
        });
		
	})

</script>
</body>
</html>